package org.rambadger.command.resource;

import org.rambadger.command.providers.ConfigParam;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.NewCookie;
import javax.ws.rs.core.Response;

@Path("/logout")
public class LogoutResource {
    private @ConfigParam("authCookieName") String cookieName;

    @GET
    public Object doLogout() {
        //For now all we need to do is clear the cookie
        //TODO: Provide a way to invalidate the token in the DB
        return Response.noContent().cookie(new NewCookie(cookieName, "")).build();

    }
}
